package com.googlecode.layout4j.parser;

import java.io.IOException;
import java.io.InputStream;

import org.apache.commons.io.IOUtils;

public class ResourceUtil {
	public static String read(String path) throws IOException {
		InputStream in = ResourceUtil.class.getResourceAsStream(path);
		if (in == null) {
			throw new NullPointerException("Null stream for " + path);
		}
		try {
			return IOUtils.toString(in);
		} finally {
			IOUtils.closeQuietly(in);
		}
	}
}
